﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Simple.HttpServer {
    public class ResourceManager {

        public ResourceProvider ResourceProvider { get; private set; }

        public ResourceManager(Configuration configuration) {
            // TODO: Initialize resource provider according to configuration
            InitializeProvider(configuration);
        }

        private void InitializeProvider(Configuration configuration) {
            var resourceProviderType = Type.GetType(configuration.ResourceProvider);
            ResourceProvider = (ResourceProvider)Activator.CreateInstance(resourceProviderType);
            var providerContext = new ResourceProviderContext();
            providerContext.Configuration = configuration;
            ResourceProvider.Initialize(providerContext);
        }
    }
}
